package com.zeta.system.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.*;
import org.zetaframework.base.entity.Entity;

import java.io.Serial;

/**
 * 字典项
 *
 * @author AutoGenerator
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Schema(description = "字典项")
@TableName("sys_dict_item")
public class SysDictItem extends Entity<Long> {

    @Serial
    private static final long serialVersionUID = 1L;

    /** 字典id */
    @Schema(description = "字典id", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "字典id不能为空")
    @TableField(value = "dict_id")
    private Long dictId;

    /** 字典项 */
    @Schema(description = "字典项", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "字典项不能为空")
    @Size(max = 32, message = "字典项长度不能超过32")
    @TableField(value = "name")
    private String name;

    /** 值 */
    @Schema(description = "值", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "值不能为空")
    @Size(max = 32, message = "值长度不能超过32")
    @TableField(value = "value")
    private String value;

    /** 描述 */
    @Schema(description = "描述", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @TableField(value = "describe_")
    private String describe;

    /** 排序 */
    @Schema(description = "排序", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
    @TableField(value = "sort_value")
    private Integer sortValue;

    /** 逻辑删除字段 */
    @JsonIgnore
    @Schema(description = "逻辑删除字段", requiredMode = Schema.RequiredMode.REQUIRED)
    @TableLogic
    private Boolean deleted;

    public SysDictItem(Long id, Long dictId, String name, String value, String describe, Integer sortValue) {
        this.id = id;
        this.dictId = dictId;
        this.name = name;
        this.value = value;
        this.describe = describe;
        this.sortValue = sortValue;
    }
}
